- Rewrite Example 1 from the Lab 11 PowerPoint without a nested loop (i.e., with just a single loop).
- Write a complete C++ program that does the following:
- Prompts the user for an odd integer between 5 and 25 (inclusive of the endpoints 5 and 25).
- If the number is not legal, forces the user to enter a legal input.
- Prints a multiplication table of all odd integers from 1 through the user's number.
Sample run of program:
Enter an odd integer between 5 and 25: 3
Invalid input! Enter an odd integer between 5 and 25: 5
1 3 5
3 9 15
5 15 25
- Write a complete C++ program that does the following:
- It asks the user to enter a positive integer.
- The program reads a value n entered by the user. If the value is not legal, the program terminates.
- The program prints a table with n lines of output. On output line number x the program should list the numbers from 1 to x together with their sum.
Sample run of program:
Enter a positive integer: 7
1 the sum is 1
1 2 the sum is 3
1 2 3 the sum is 6
1 2 3 4 the sum is 10
1 2 3 4 5 the sum is 15
1 2 3 4 5 6 the sum is 21
1 2 3 4 5 6 7 the sum is 28
- Write a complete C++ program that does the following.
- The program prints a table with 10 lines of output.
- On output line number x the program should list the numbers from x through x^2 (x squared) together with their sum.
For example, the first 4 lines of output read as follows:
1 the sum is 1
2 3 4 the sum is 9
3 4 5 6 7 8 9 the sum is 42
4 5 6 7 8 9 10 11 12 13 14 15 16 the sum is 130
- Write a complete C++ program that generates a multiplication table of custom dimensions by doing the following:
- Asks the user for positive integer between 2 and 10 for the row count
- Asks the user for positive integer between 2 and 10 for the column count
- Print a multiplication table where each entry is the product of the row and column values.
Once you have the multiplication table in place, try modifying the code to produce the table below. Full credit given for just completing the bulleted items above.
Enter number of rows: 4
Enter number of columns: 3
1x1=1 2x1=2 3x1=3
1x2=2 2x2=4 3x2=6
1x3=3 2x3=6 3x3=9
1x4-4 2x4=8 3x4=12